package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import com.vip.vcsp.multiprocess.IConnectListener;
import com.vip.vcsp.multiprocess.IInvokeListener;
import com.vip.vcsp.multiprocess.MultiProcessHelper;
import com.vip.vcsp.multiprocess.MultiProcessManager;

public class Main2Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        getData();
    }

    private void getData(){
        MultiProcessManager.connect(this, new IConnectListener() {
            @Override
            public void onConnect(MultiProcessHelper helper) {
//                MultiProcessManager.invoke(helper, Fruit.class, "getApple", new IInvokeListener<Apple>() {
//                    @Override
//                    public void onResult(Apple apple) {
//                        Log.d("Main2Activity",""+apple.getPrice()+apple.getWeight());
//                    }
//                },new Object[]{});
                MultiProcessManager.invoke(helper, Fruit.class, "getAppleByPrice", new IInvokeListener<Apple>() {
                    @Override
                    public void onResult(Apple apple) {
                        Log.d("Main2Activity",""+apple.getPrice()+apple.getWeight());
                    }
                },50);
            }
        });
    }
}
